package com.Maykk.Demo01;

/**
 * @ClassName DemoTest
 * @Description: TODO Demo 测试类
 * @Author: MaykkSTAR@163.com
 * @DATE: 2023/2/28
 */
public class DemoTest {
    public static void main(String[] args) {
        Animal animal = new Cat();
        // 多态调用成员方法: 编译看左，运行看右
        animal.run();
        // 多态调用成员属性： 编译运行都看左
        System.out.println(animal.name);
        System.out.println(animal.age);
        System.out.println("+++++++++++++++++++++++++++++++++");

        Creature creature01 = new Animal();
        creature01.move();

        System.out.println("+++++++++++++++++++++++++++++++++");
        Creature creature = new Cat();
        // 调用成员方法：编译看左，运行看右
        creature.move();
        // 调用成员属性：编译运行都看左
        System.out.println(creature.name);
        System.out.println(creature.age);
    }
}
